Skip to content

server: allow to specify tokens as strings in logit_bias #5003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2024

Conversation

z80maniac
Copy link
Contributor

Currently, the logit_bias param in the server accepts token IDs as input. But first these token IDs need to be retrieved from somewhere. It is possible to pass a string to /tokenize and then use the result. However, it's pretty cumbersome since it requires to code for a completely different endpoint and makes an additional network call.

This PR allows to pass the initial string to the logit_bias param. This string will then be converted to tokens and the specified bias will be applied to all these tokens.

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
@ggerganov ggerganov merged commit 6847801 into ggml-org:master Feb 11, 2024
@Solido
Copy link

Solido commented Feb 12, 2024

Thanks for this PR.
Would it be possible to port it to example/main?

@z80maniac
Copy link
Contributor Author

Would it be possible to port it to example/main?

I'm not interested in main, so maybe somebody else can submit a PR.

jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
)

* server: allow to specify tokens as strings in logit_bias

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
)

* server: allow to specify tokens as strings in logit_bias

* Apply suggestions from code review

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants